<?php
require_once('classes/settings.php');
require_once('classes/pagination.php');
require_once('classes/search.php');
require_once('classes/tickets.php');
require_once('classes/resultHandler.php');
require_once('classes/filter.php');
require_once('classes/database.php');
require_once('classes/customTickets.php');
require_once('classes/customTickets/cheapTickets.php');

session_start();
if (isset($_SESSION['search'])) {
    unset($_SESSION);
    session_destroy();
    session_start();
}

//TODO to much parameters
$_SESSION['search'] = new Search(
                $_GET['deptCity'],
                $_GET['arrCity'],
                $_GET['deptDate'],
                $_GET['retDate'],
                $_GET['adults'],
                $_GET['children'],
                $_GET['infants'],
                $_GET['retour']
);




$resultHandler = new resultHandler($_SESSION['search']);
$_SESSION['allTickets'] = $resultHandler->getAllTickets();
?>
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">

        <!-- Use the .htaccess and remove these lines to avoid edge case issues.
             More info: h5bp.com/i/378 -->
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

        <title>Vliegticketsgoedkoop</title>
        <meta name="description" content="">

        <!-- Mobile viewport optimized: h5bp.com/viewport -->
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->

        <meta charset="utf-8">

        <link rel="stylesheet" href="css/styling.css">
        <link rel="stylesheet" href="css/result.css">
        <link rel="stylesheet" href="css/styling.css">
        <link rel="stylesheet" href="css/vlieg-theme/jquery-ui-1.8.23.custom.css" />
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
        <script src="http://code.jquery.com/ui/1.8.24/jquery-ui.min.js" type="text/javascript"></script>
        <script src="js/ajaxRequests.js" type="text/javascript"></script>
        <!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->

        <!-- All JavaScript at the bottom, except this Modernizr build.
             Modernizr enables HTML5 elements & feature detects for optimal performance.
             Create your own custom Modernizr build: www.modernizr.com/download/ -->
        <script src="js/libs/modernizr-2.5.3.min.js"></script>

    </head>
    <body>
        <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you support IE 6.
             chromium.org/developers/how-tos/chrome-frame-getting-started -->
        <!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
        <header>
            <div id="headerwrap">
                <div id="headertop">
                    <div id="logo">
                        <div class="logo"></div>
                        <div class="vliegticketsLogo">Vliegtickets</div>
                        <div class="vliegticketsLogo2">goedkoop.nl</div>
                    </div>
                    <div class="headerlinks">
                        <ul class="headermenu">
                            <li>contact</li>
                            <li>over ons</li> 
                            <li>klantenservice</li>
                        </ul>
                    </div>
                </div>
                <div id="menu">
                    <ul class="menuitems">
                        <a href="index.php"> <li class="aanbieding home"><div class="aanbiedingLink " style="color:#FFF;">Home</div></li></a>
                        <a href="populaire-bestemmingen.php"> <li class="aanbieding"><div class="aanbiedingLink" style="color:#FFF;">Populaire bestemmingen</div></li></a>
                        <a href="populaire-bestemmingen.php"><li class="aanbieding"><div  class="aanbiedingLink" style="color:#FFF;">Aanbiedingen</div></li></a>
                    </ul>
                </div>
            </div>
        </header>
        <div  id="main" role="main" style="font-family:arial">
            <div id="wrapper" style="height:auto;">
                <?php
                $deptCity = explode("- Luchthaven", $_GET['deptCity']);
                ?>
                <div class="breadcrumb"> Home > <?php echo $deptCity[0]; ?> > Zoekresultaten</div>
                <div id="bgVlucht">
                    <!--- FORM -->
                    <?php include("includes/form.php"); ?>
                    <!---/FORM-->
                    <div id="bgTickets">

                        <div id="panelBackground" style="display: none;"></div>	
                        <div id="bookingPanelPopup" style="display: none;"></div>


                        <script type="text/javascript">
                            $('body').delegate('#closeDetailsImg', 'click', function() {
                                document.getElementById("closeDetailsImg").style.display = 'none'; 
                                document.getElementById("bookingPanelPopup").style.display = 'none'; 
                                document.getElementById("panelBackground").style.display = 'none'; 
                                $("#reisduur-range").css({opacity: 1})
                                $("#heenreis-range").css({opacity: 1})
                                $("#terugreis-range").css({opacity: 1})
                            });
				
                        </script>
                        <div id="results">
                            <?php require_once('includes/page.php'); ?>
                        </div>



                        <div id="ajaxBusy">
                            <img class="pacman" alt="pacman" style="margin-top: 15px; position: absolute; width:50px;" src="images/42.gif"/>
                        </div> 
                    </div>
                </div> 
            </div>
        </div>

    </body>
</html>
